package com.xh.hongaicodegenerator.langgraph4j.ai;

import com.xh.hongaicodegenerator.utils.SpringContextUtil;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.service.AiServices;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * 代码质量检查服务工厂
 */
@Slf4j
@Configuration
public class CodeQualityCheckServiceFactory {

    /**
     * 创建代码质量检查 AI 服务
     */

    public CodeQualityCheckService createCodeQualityCheckService() {
        // 多例模式
        ChatModel chatModel = SpringContextUtil.getBean("codeQualityCheckChatModel", ChatModel.class);
        return AiServices.builder(CodeQualityCheckService.class)
                .chatModel(chatModel)
                .build();
    }
}